﻿<UserControl x:Class="Dsl.Ped.Desktop.Modules.ErrorViewer.ErrorViewerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:framework="clr-namespace:Dsl.Ped.Framework.Resources;assembly=DslPedFramework"
             xmlns:resources="clr-namespace:Dsl.Ped.Desktop.Resources"
             MinHeight="200"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/DSLPedDesktop;component/Modules/ErrorViewer/ErrorViewerResourceTemplate.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <DockPanel>
            <Label DockPanel.Dock="Top" x:Name="lbErrorList"  
                   Content="{x:Static framework:Lang.ErrorList}" />

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <StackPanel Orientation="Horizontal"
                                        Grid.Row="0">
                    <ToggleButton Content="{x:Static resources:DesktopLang.Messages}"
                                  IsChecked="{Binding Path=IsInfoSelected}"/>
                    <Separator Margin="1,0,1,0" >
                        <Separator.LayoutTransform>
                            <RotateTransform Angle="90" />
                        </Separator.LayoutTransform>
                    </Separator>
                    <ToggleButton Content="{x:Static resources:DesktopLang.Warnings}"
                                                IsChecked="{Binding Path=IsWarningsSelected}"/>
                    <Separator Margin="1,0,1,0" >
                        <Separator.LayoutTransform>
                            <RotateTransform Angle="90" />
                        </Separator.LayoutTransform>
                    </Separator>
                    <ToggleButton Content="{x:Static resources:DesktopLang.Errors}"
                                  IsChecked="{Binding Path=IsErrorsSelected}"/>
                </StackPanel>

                <ScrollViewer Grid.Row="1">
                    <ListView ItemsSource="{Binding Path=Messages}"                                     
                                            ClipToBounds="True"
                                            Grid.IsSharedSizeScope="False"
                                            Panel.ZIndex="0">
                        <ListView.View>
                            <GridView AllowsColumnReorder="False">
                                <GridViewColumn Header="" CellTemplateSelector="{StaticResource iconTemplateSelector}" >
                                </GridViewColumn>
                                <GridViewColumn Header="Description" Width="300">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock TextWrapping="Wrap" 
                                                       Text="{Binding Path=Description}"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                        <ListView.ItemContainerStyle>
                            <Style TargetType="{x:Type ListViewItem}">
                                <Setter Property="BorderThickness" Value="0.5" />
                                <Setter Property="BorderBrush" Value="Black" />
                            </Style>
                        </ListView.ItemContainerStyle>
                    </ListView>
                </ScrollViewer>
            </Grid>
        </DockPanel>
    </Grid>
</UserControl>
